<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script type="text/javascript">

function checkForBlanck(){
	var errMsg=" ";
	
	if(document.getElementById('fname').value==""){
		errMsg+="Enter your First Name\n";
	    alert('Please...Enter your First Name');
		document.getElementById('fname').style.borderColor="red";
		return false;
	}
	
	if(document.getElementById('lname').value==""){
		errMsg+="Enter your Last Name\n";
		alert('Please...Enter your Last Name');
		document.getElementById('lname').style.borderColor="red";
		return false;
	}
	
	if(errMsg!=" "){
		alert(errMsg);
		return false;
	}
}

</script>

</head>
<body>
<form action="#" method="post" onsubmit="return checkForBlanck()">
<fieldset>
<label>FistName :<input type="text" name="fname" id="fname"/></label><br>
<label>LastName:<input type="text" name="lname" id="lname"/></label><br>
<input type="submit" value="Submit">
</fieldset>
</form>

</body>
</html>